package untils

import (
	"encoding/json"
	"fmt"
	"shop/common/inits"
	"shop/common/model"
)

func PublishMQ(seckillOrder *model.Order) error {
	marshal, _ := json.Marshal(seckillOrder)

	rabbitmq := inits.NewRabbitMQSimple("" +
		"yzy")
	simple, err := rabbitmq.PublishSimple(string(marshal))
	if simple == false {
		return err
	}
	if err != nil {
		return err
	}
	fmt.Println("发送成功！")
	return nil
}
